package string;

public class StringBuilderDemo {
    public static void main(String[] args) {
      /*  StringBuilder builder1=new StringBuilder();
        StringBuilder builder2=new StringBuilder("abc");

        String str="abc";
        StringBuilder builder3=new StringBuilder(str);
        String builder4= builder3.toString();*/

        String str="好好学习java,天天向上";
        StringBuilder builder=new StringBuilder(str);
        builder.append("，为了找个好工作");//好好学习java,天天向上，为了找个好工作
        System.out.println(builder);

        builder.replace(8,12,"学好java");//好好学习java，学好java，为了找个好工作
        System.out.println(builder);

        builder.delete(8,14);//好好学习java，为了找个好工作
        System.out.println(builder);

        builder.insert(7,"努力坚持");//好好学习java努力坚持，为了找个好工作
        System.out.println(builder);
    }
}
